import os
import shutil

def rename_and_copy_files(source_folder, destination_folder):
    # Create destination folder if it doesn't exist
    if not os.path.exists(destination_folder):
        os.makedirs(destination_folder)
        print(f"Created destination folder: {destination_folder}")
    
    # Get all files in the source folder
    files = [f for f in os.listdir(source_folder) if os.path.isfile(os.path.join(source_folder, f))]
    
    for file in files:
        # Split the filename by underscore
        parts = file.split('_')
        
        # Check if the file name has at least 3 parts (2 underscores)
        if len(parts) >= 3:
            # Get the new name by joining parts after the second underscore
            new_name = '_'.join(parts[2:])
            
            # Construct full file paths
            old_path = os.path.join(source_folder, file)
            new_path = os.path.join(destination_folder, new_name)
            
            # Copy the file to destination with new name
            shutil.copy2(old_path, new_path)
            print(f"Copied and renamed: {file} -> {new_name}")
        else:
            print(f"Skipped: {file} (doesn't have at least 2 underscores)")

# Example usage
source_folder = '/path/to/source/folder'      # Replace with your source folder path
destination_folder = '/path/to/destination'   # Replace with your destination folder path
rename_and_copy_files(source_folder, destination_folder)